package com.rd.student.jiaji.class3.sunguowei.day0802;

public abstract class Animal {
    String name;
    public abstract void voice();

    public abstract String enjoy();

}

class Cat extends Animal{
    @Override
    public void voice() {
        System.out.println("喵喵");
    }

    @Override
    public String enjoy() {
        return null;
    }
}

class Pig extends Animal{
    @Override
    public void voice(){
        System.out.println("哼哼");
    }
    @Override
    public String enjoy() {
        return null;
    }
}
class Dog extends Animal{
    @Override
    public void voice() {
        System.out.println("汪汪");
    }
    @Override
    public String enjoy() {
        return null;
    }
}
class Store{
    public static Animal getInstance(String pet){
        if(pet.equals("dog")){
            return new Dog();
        }if(pet.equals("pig")){
            return new Pig();
        }else {
            return new Cat();
        }
    }
}

